<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>v-for 列表渲染</title>
    <script src="https://unpkg.com/vue@3"></script>
</head>
<body>
    <div id="app">
        <h1>列表渲染主要是通过v-for指令来实现的</h1>
        <h1>知识点1：迭代普通数组</h1>
            <ul>
                <li v-for="item in times">桃花</li>
            </ul>
            <ul>
                <li v-for="item in flowers">{{item}}</li>
            </ul>
        <h1>知识点2：迭代对象数组</h1>
            <ul>
                <li v-for="(item,index) in users">{{item.name}}---{{index}}</li>
            </ul>    
        <h1>知识点3：迭代对象里的属性</h1>
            <ul>
                <li v-for="(val,key) in uers">{{key}}----{{val}}</li>
            </ul>    
        <h1>知识点4：迭代数字</h1>
            <ul v-for="item in 10">{{item}}</ul>
        <h1>知识点5：关于key属性</h1>
        ID:<input type="text" v-model="id">
        NAME:<input type="text" v-model="name">
        <button>添加</button>
        <button>删除</button>
        我新添加的ID是{{id}},我新添加的name是{{name}}
        
        <table>
            <tr v-for="item in users">
                <td><input type="checkbox"</td>
                <td>{{item.id}}</td>
                <td>{{item.name}}</td>
            </tr>
        </table>
<br> <br> <br> <br> <br> <br> <br> <br>


    </div>


    
</body>
</html>

<script>
    const appConn=Vue.createApp({
        data(){
        return{
            times:30,
            flowers:['桃花','梅花','梨花','菊花','兰花','杏花','银花'],
            users:[{id:'001',name:'赵丽颖'},{id:'002',name:'田曦薇'}]
        }
}
    }).mount("#app")
</script>